package com.springboot.controller;

import com.springboot.pojo.base.BaseModel;
import com.springboot.pojo.loginPojo;
import com.springboot.service.loginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;

import java.util.Calendar;

@RestController
@RequestMapping("Auth")
public class loginController {
    @Autowired
    loginService loginService;
    @Autowired
    private Environment environment;

    @CrossOrigin(origins = "*")
    @PostMapping("/Login")
    public BaseModel loginInfo(@RequestBody(required = false) loginPojo login, BaseModel baseModel) throws Exception {


        loginService.selectLoginInfo(login.getCustomerName(),baseModel);

//        String pwd = loginService.selectLoginInfo(login.getName(), baseModel);
//        System.out.println(environment.getProperty("spring."));
//        if (pwd.equals(login.getPassword())) {
//            baseModel.setMessage("登录成功");
//        } else {
//            baseModel.setMessage("密码或者账号失败");
//            baseModel.setStatusCode(1);
//        }
        return baseModel;
    }



}
